Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: plugin loading performance [patch/2.40.0] #2294

Merged

Conversation

jenniferarnesen
Copy link
Collaborator

@jenniferarnesen jenniferarnesen commented May 3, 2023

This PR implements strategies to improve load time of the dashboard. The first time a dashboard is opened, only one plugin of each type (MAP, VISUALIZATION, LINE LIST) is loaded initially. Once those plugins report that they have loaded, then the other dashboard items proceed to load. This prevents multiple requests for the IFrame resources.

In order to cleanly apply these changes to the patch/2.40.0 branch, 2 backports had to be included:

  1. fix: consolidate legacy and default plugin and fix resizing #2254
  • the offline message was not showing on EE maps. A blank item was shown, leading user to think the map just wasn't loading.
  • The legacy plugin (old ER and EV) was not resizing in edit mode.
  • Refactor: no longer need DefaultPlugin (merged together with LegacyPlugin) and MapPlugin (everything now handled in Visualization.js).
  1. fix: fix props handling when switching Map <-> DV plugins #2272
  • fix problem when switching between Map and DV using "View as"
    Description
    When using "View as" and switching between Map and chart/table or viceversa, the plugin loaded in the iframe needs to change.
    This transition didn't work because the message listener in dashboard was not in place when the plugin requested getProps, resulting in the Map/chart/table not showing.
    Switching between chart and table worked because in that case the plugin does not change and the newProps message is used instead of getProps.
    The getProps listener is still removed in the cleanup function returned by the useEffect, but it's recreated if the iframe src change (plugin change).
    After the first getProps message is received there shouldn't be other getProps messages incoming, but newProps is used for passing new/modified props instead.

About the changes in en.pot: The strings that appear to have been removed, were actually duplicated in the file, so this is a legit cleanup.

jenniferarnesen and others added 4 commits May 3, 2023 10:10
…2268)

* fix: consolidate legacy and default plugin and fix ER/EV resizing

* fix: show offline message on EE maps

---------

Co-authored-by: Jan Henrik Øverland <janhenrik.overland@gmail.com>
…[DHIS2-15097] (#2285)

* feat(iframe-plugin): receive pwa installation status from plugins

* chore: add todos

* fix: wait to render until the first item of the type has gotten the plugin

* fix: add property to the top-most item of each iframe plugin type

* fix: dont use the <Layer> component

* chore: cli-app-scripts upgrade

* fix: remove unused var

* refactor: combine loops

---------

Co-authored-by: Jen Jones Arnesen <jennifer@dhis2.org>
@dhis2-bot
Copy link
Contributor

dhis2-bot commented May 3, 2023

🚀 Deployed on https://pr-2294--dhis2-dashboard.netlify.app

@dhis2-bot dhis2-bot temporarily deployed to netlify May 3, 2023 08:16 Inactive
@cypress
Copy link

cypress bot commented May 3, 2023

Passing run #3254 ↗︎

0 51 0 0 Flakiness 0

Details:

fix: center spinner
Project: dashboards-app Commit: ad9d17c0c9
Status: Passed Duration: 04:38 💡
Started: May 3, 2023 2:02 PM Ended: May 3, 2023 2:07 PM

This comment has been generated by cypress-bot as a result of this project's GitHub integration settings.

@dhis2-bot dhis2-bot temporarily deployed to netlify May 3, 2023 08:25 Inactive
@dhis2-bot dhis2-bot temporarily deployed to netlify May 3, 2023 11:14 Inactive
Copy link
Contributor

@KaiVandivier KaiVandivier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested the LL “version gate” and the “load first-of-type” features, and they seem to be working well 🙂 haven't tested the other things that were merged in though

@dhis2-bot dhis2-bot temporarily deployed to netlify May 3, 2023 14:03 Inactive
@jenniferarnesen jenniferarnesen merged commit 3efe9aa into patch/2.40.0 May 3, 2023
@jenniferarnesen jenniferarnesen deleted the fix/plugin-loading-performance-patch/2.40.0 branch May 3, 2023 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants